<template>
  <div >
    <el-row
      v-loading="loading"
      :gutter="24">
      <el-col
        v-for="item in photosList"
        :key="item.collect_count"
        :span="8"
        :xs="24"
        :sm="24"
        :md="8"
        :lg="8"
        :xl="8">
        <el-card :body-style="{ padding: '0px' }">
          <img :src="item.images.small" class="image" alt:="item.alt">
          <div style="padding: 14px;">
            <span>{{ item.title }}</span>
            <div class="bottom clearfix">
              <time class="time">{{ item.year }}</time>
              <el-button type="text" class="button">{{ item.directors[0].name }}</el-button>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: 'Test',
  data() {
    return {
      title: '测试提交以下',
      pageInfo: {
        start: 0,
        count: 30
      },
      photosList: [],
      loading: false
    }
  },
  created() {
    console.log('created===')
    this.loading = true
    this.getMovies()
  },
  methods: {
    async getMovies() {
      try {
        const res = await this.$api.douban.movieList(this.pageInfo)
        this.photosList = res.subjects
        console.log(this.photosList)
        this.loading = false
      } catch (e) {
        console.log(e)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
  .el-row {
    padding: 10px;
  }
  .time {
    font-size: 13px;
    color: #999;
  }
  .el-col {
    margin-top: 10px;
  }
  .bottom {
    margin-top: 13px;
    line-height: 12px;
  }

  .button {
    padding: 0;
    float: right;
  }

  .image {
    height: 400px;
    width: 100%;
    display: block;
    margin: 0 auto;
  }

  .clearfix:before,
  .clearfix:after {
      display: table;
      content: "";
  }

  .clearfix:after {
      clear: both
  }
</style>
